package com.ruoyi.leave.service.impl;

import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.apache.commons.lang3.StringUtils;
import com.ruoyi.leave.mapper.LeaveApplyCourseMapper;
import com.ruoyi.leave.domain.LeaveApplyCourse;
import com.ruoyi.leave.service.ILeaveApplyCourseService;

import java.util.List;

/**
 * 请假涉及课程Service业务层处理
 *
 * @author ruoyi
 * @date 2024-10-27
 */
@Service
public class LeaveApplyCourseServiceImpl extends ServiceImpl<LeaveApplyCourseMapper, LeaveApplyCourse> implements ILeaveApplyCourseService {

    @Override
    public List<LeaveApplyCourse> queryList(LeaveApplyCourse leaveApplyCourse) {
        LambdaQueryWrapper<LeaveApplyCourse> lqw = Wrappers.lambdaQuery();
        if (leaveApplyCourse.getApplyId() != null){
            lqw.eq(LeaveApplyCourse::getApplyId ,leaveApplyCourse.getApplyId());
        }
        if (StringUtils.isNotBlank(leaveApplyCourse.getCourseName())){
            lqw.like(LeaveApplyCourse::getCourseName ,leaveApplyCourse.getCourseName());
        }
        if (leaveApplyCourse.getCourseNum() != null){
            lqw.eq(LeaveApplyCourse::getCourseNum ,leaveApplyCourse.getCourseNum());
        }
        if (StringUtils.isNotBlank(leaveApplyCourse.getCoursePic())){
            lqw.eq(LeaveApplyCourse::getCoursePic ,leaveApplyCourse.getCoursePic());
        }
        return this.list(lqw);
    }

}